package com.ims.core.doc.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ims.common.annotation.Log;
import com.ims.common.core.controller.BaseController;
import com.ims.common.core.domain.AjaxResult;
import com.ims.common.enums.BusinessType;
import com.ims.core.doc.domain.TInNon1007;
import com.ims.core.doc.service.ITInNon1007Service;
import com.ims.common.utils.poi.ExcelUtil;
import com.ims.common.core.page.TableDataInfo;

/**
 * 通用机打发票1007Controller
 *
 * @author IMS
 * @date 2024-11-20
 */
@RestController
@RequestMapping("/doc/tongyongjida")
public class TInNon1007Controller extends BaseController
{
    @Autowired
    private ITInNon1007Service tInNon1007Service;

    /**
     * 查询通用机打发票1007列表
     */
    @PreAuthorize("@ss.hasPermi('doc:tongyongjida:list')")
    @GetMapping("/list")
    public TableDataInfo list(TInNon1007 tInNon1007)
    {
        startPage();
        List<TInNon1007> list = tInNon1007Service.selectTInNon1007List(tInNon1007);
        return getDataTable(list);
    }

    /**
     * 导出通用机打发票1007列表
     */
    @PreAuthorize("@ss.hasPermi('doc:tongyongjida:export')")
    @Log(title = "通用机打发票1007", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TInNon1007 tInNon1007)
    {
        List<TInNon1007> list = tInNon1007Service.selectTInNon1007List(tInNon1007);
        ExcelUtil<TInNon1007> util = new ExcelUtil<TInNon1007>(TInNon1007.class);
        util.exportExcel(response, list, "通用机打发票1007数据");
    }

    /**
     * 获取通用机打发票1007详细信息
     */
    @PreAuthorize("@ss.hasPermi('doc:tongyongjida:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tInNon1007Service.selectTInNon1007ById(id));
    }

    /**
     * 新增通用机打发票1007
     */
    @PreAuthorize("@ss.hasPermi('doc:tongyongjida:add')")
    @Log(title = "通用机打发票1007", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TInNon1007 tInNon1007)
    {
        return toAjax(tInNon1007Service.insertTInNon1007(tInNon1007));
    }

    /**
     * 修改通用机打发票1007
     */
    @PreAuthorize("@ss.hasPermi('doc:tongyongjida:edit')")
    @Log(title = "通用机打发票1007", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TInNon1007 tInNon1007)
    {
        return toAjax(tInNon1007Service.updateTInNon1007(tInNon1007));
    }

    /**
     * 删除通用机打发票1007
     */
    @PreAuthorize("@ss.hasPermi('doc:tongyongjida:remove')")
    @Log(title = "通用机打发票1007", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tInNon1007Service.deleteTInNon1007ByIds(ids));
    }
}
